--
--    Copyright 2010-2016 the original author or authors.
--
--    Licensed under the Apache License, Version 2.0 (the "License");
--    you may not use this file except in compliance with the License.
--    You may obtain a copy of the License at
--
--       http://www.apache.org/licenses/LICENSE-2.0
--
--    Unless required by applicable law or agreed to in writing, software
--    distributed under the License is distributed on an "AS IS" BASIS,
--    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--    See the License for the specific language governing permissions and
--    limitations under the License.
--

-- // add schema sys log
-- Migration SQL that makes the change goes here.
begin;
create table sys_log (
    ID bigint primary key auto_increment,
    OPER_TIME DATETIME not null,
    OPERATOR_ID INT NOT NULL COMMENT '操作人员id，映射到sys_user',
    LOG_CONTENT VARCHAR(500) NOT NULL,
    RESULT SMALLINT NOT NULL DEFAULT 0 COMMENT '操作结果，0 成功；其它值：失败',
    IP varchar(20),
    TYPE SMALLINT COMMENT '日志类型。系统日志：1；操作日志：2'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统日志表';

-- 添加新模块权限及菜单
insert into sys_rights(ID, `NAME`, TYPE, URL, P_ID, SORT_ORDER, LOG_INFO) VALUES
(21, '系统日志', 0, '/syslog/ui', 1, 5, NULL),
(22, '查看系统日志', 1, '/syslog*', 21, 1, '查看系统日志');
-- 添加超级管理员权限
insert into sys_role_rights(ROLE_ID, RIGHT_ID) SELECT 1,ID FROM sys_rights WHERE ID IN(21,22);
commit;
-- //@UNDO
-- SQL to undo the change goes here.


